Avatar

# Simulate 100,000 draws from Poisson(2)
poisson_sample <-rpois(100000,lambda=2)

# Find the percentage of simulated values that are 0
mean(poisson_sample==0)

# Use dpois to find the exact probability that a draw is 0
dpois(x=0,lambda=2)